{% extends "base.html" %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="card-title mb-0">质量追溯记录详情</h4>
                </div>
                <div class="card-body">
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <label class="form-label fw-bold">批次号</label>
                            <p>{{ trace.batch_number }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">产品名称</label>
                            <p>{{ trace.product_name }}</p>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <label class="form-label fw-bold">生产日期</label>
                            <p>{{ trace.production_date.strftime('%Y-%m-%d') }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">有效期</label>
                            <p>{{ trace.expiration_date.strftime('%Y-%m-%d') }}</p>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <label class="form-label fw-bold">生产商</label>
                            <p>{{ trace.manufacturer }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">储存条件</label>
                            <p>{{ trace.storage_condition or '未设置' }}</p>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <label class="form-label fw-bold">质量标准</label>
                            <p>{{ trace.quality_standard or '未设置' }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">检验员</label>
                            <p>{{ trace.inspector or '未指定' }}</p>
                        </div>
                    </div>
                    <div class="row mb-3">
                        <div class="col-md-6">
                            <label class="form-label fw-bold">检验日期</label>
                            <p>{{ trace.inspection_date.strftime('%Y-%m-%d') if trace.inspection_date else '未检验' }}</p>
                        </div>
                        <div class="col-md-6">
                            <label class="form-label fw-bold">检验结果</label>
                            <p>
                                {% if trace.inspection_result == 'passed' %}
                                    <span class="badge bg-success">合格</span>
                                {% elif trace.inspection_result == 'failed' %}
                                    <span class="badge bg-danger">不合格</span>
                                {% else %}
                                    <span class="badge bg-warning">待检验</span>
                                {% endif %}
                            </p>
                        </div>
                    </div>
                    <div class="mb-3">
                        <label class="form-label fw-bold">备注</label>
                        <p>{{ trace.notes or '无' }}</p>
                    </div>
                    <div class="d-grid gap-2">
                        <a href="{{ url_for('quality.trace_edit', id=trace.id) }}" class="btn btn-primary">编辑</a>
                        <a href="{{ url_for('quality.trace_list') }}" class="btn btn-secondary">返回列表</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 